package com.hong.chapter2;

/**
 * 计算器
 * @author hong
 * @date 2018/5/28
 */
public class TaxCalaculator {
    private final double salary;

    private final double bonus;

    private CalculatorStrategy calculatorStrategy;

    public TaxCalaculator(double salary,double bonus,CalculatorStrategy calculatorStrategy){
        this.salary = salary;
        this.bonus = bonus;
        this.calculatorStrategy =calculatorStrategy;
    }

    protected double calcTax(){
        return calculatorStrategy.calculate(salary,bonus);
    }

    public double calcuate(){
        return this.calcTax();
    }

    public double getSalary() {
        return salary;
    }

    public double getBonus() {
        return bonus;
    }

    public void setCalculatorStrategy(CalculatorStrategy calculatorStrategy) {
        this.calculatorStrategy = calculatorStrategy;
    }
}
